/*
* 頭部
*/

import React, { Component } from 'react'
import render from 'react-dom'
import { bindActionCreators } from 'redux'
import { connect } from 'react-redux'


class Header extends Component {
	defaultBackClick() {
		history.back();
	}
	render() {
		var 	   self = this,
				hdClass = self.props.hdClass ? self.props.hdClass : "hd-inner",
			  backClass = self.props.backClass ? self.props.backClass : "hd-back";
		var    backName = self.props.backName ? self.props.backName : "",
			  titleName = self.props.titleName,
			  backClick = self.props.backClick ? self.props.backClick : self.defaultBackClick;

		return (
			<section ref="hd-wrap" className="hd-wrap">
				<div id="hd-inner" className={hdClass}>
					{
						self.props.back ? <a href="javascript:;" onClick={() => backClick()} className={backClass}>{backName}</a> : null 
					}
					{
						self.props.logo ? <div className="hd-logo"></div>
						:
						<div className="hd-main">{titleName}</div>
					}
					{ self.props.rightContent ? self.props.rightContent : null }
				</div>
			</section>
		);
	}
}

export default connect()(Header)